<template>
  <div class="home">
    <input type="text" v-model="form.username">
    <input type="text" v-model="form.password">
    <button @click="login">登录</button>
  </div>
</template>

<script>
// @ is an alias to /src
// import HelloWorld from '@/components/HelloWorld.vue'
import {loginApi} from '@/utils/api.js'
export default {
  name: 'HomeView',
  data() {
    return {
        form:{
            username:'',
            password:''
        }
    }
  },
  methods: {
    login(){
        //   调用封装的loginApi请求
        loginApi(this.form).then(res=>{
            console.log(res);
            // localStorage.setItem('token',res.data.data.token)
        })
    }
  },
  components: {
    // HelloWorld
  }
}
</script>
